package com.gxuwz.stats.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gxuwz.stats.entity.TotalWork;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface TotalWorkMapper extends BaseMapper<TotalWork> {
    //查询该二级学院信息
//    @Select("<script>" +
//            "SELECT tw.*, u.username, u.department " +
//            "FROM rsp_total_work tw " +
//            "LEFT JOIN rsp_user u ON tw.user_id = u.user_id " +
//            "WHERE 1=1 " +
//            "<if test='department != null and department != \"\"'> AND u.department = #{department} </if>" +
//            "<if test='username != null and username != \"\"'> AND u.username LIKE CONCAT('%', #{username}, '%') </if>" +
//            "</script>")
    IPage<Map<String, Object>> selectTotalWorkJoinUser(IPage<TotalWork> page, @Param("department") String department, @Param("username") String username);

//    @Select("SELECT t.*, u.username " +
//            "FROM rsp_total_work t " +
//            "LEFT JOIN rsp_user u ON t.user_id = u.user_id " +
//            "${ew.customSqlSegment}")
//    IPage<TotalWork> selectTotalWorkWithUsername(IPage<TotalWork> page, @Param(Constants.WRAPPER) Wrapper<TotalWork> queryWrapper);

//    @Select("SELECT tw.*, u.department " +
//            "FROM rsp_total_work tw " +
//            "LEFT JOIN rsp_user u ON tw.user_id = u.user_id ${ew.customSqlSegment}")
//    IPage<Map<String, Object>> selectTotalWorkListWithUserInfo(@Param("page") Page<?> page,
//                                                               @Param(Constants.WRAPPER) Wrapper<TotalWork> queryWrapper);
}
